From: Andy Chiang Date: Mon, 20 Oct 2025 21:18:35 +0000 (+0700) Subject: modules: fix default values X-Git-Url: http://git.openwrt.org/%22https:/collectd.org/%22http:/www.crowdsec.net//%22https%22/%22https:/collectd.org/%22http:/www.crowdsec.net/%22https%22?a=commitdiff_plain;h=f83fe35daee3338d5cfb5b6bc241a7620167c387;p=project%2Fluci.git modules: fix default values fix default values for luci-base and luci-mod-{dashboard,status,system} Signed-off-by: Andy Chiang --- diff --git a/modules/luci-base/htdocs/luci-static/resources/tools/views.js b/modules/luci-base/htdocs/luci-static/resources/tools/views.js index e223600215..01cd7556ab 100644 --- a/modules/luci-base/htdocs/luci-static/resources/tools/views.js +++ b/modules/luci-base/htdocs/luci-static/resources/tools/views.js @@ -73,12 +73,12 @@ var CBILogreadBox = function(logtag, name) { try { const tz = uci.get('system', '@system[0]', 'zonename')?.replaceAll(' ', '_'); const ts = uci.get('system', '@system[0]', 'clock_timestyle') || 0; - const hc = uci.get('system', '@system[0]', 'clock_hourcycle') || 'h23'; + const hc = uci.get('system', '@system[0]', 'clock_hourcycle') || 0; const logEntries = await callLogRead(this.fetchMaxRows, false, true); const dateObj = new Intl.DateTimeFormat(undefined, { dateStyle: 'medium', timeStyle: (ts == 0) ? 'long' : 'full', - hourCycle: hc, + hourCycle: (hc == 0) ? undefined : hc, timeZone: tz }); diff --git a/modules/luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js b/modules/luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js index 2990929cc9..6a06edf531 100644 --- a/modules/luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js +++ b/modules/luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/10_router.js @@ -315,12 +315,12 @@ return baseclass.extend({ const date = new Date(unixtime * 1000); const zn = uci.get('system', '@system[0]', 'zonename')?.replaceAll(' ', '_') || 'UTC'; const ts = uci.get('system', '@system[0]', 'clock_timestyle') || 0; - const hc = uci.get('system', '@system[0]', 'clock_hourcycle') || 'h23'; + const hc = uci.get('system', '@system[0]', 'clock_hourcycle') || 0; datestr = new Intl.DateTimeFormat(undefined, { dateStyle: 'medium', timeStyle: (ts == 0) ? 'long' : 'full', - hourCycle: hc, + hourCycle: (hc == 0) ? undefined : hc, timeZone: zn }).format(date); } diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js index 043051e462..3a2d2f1f2f 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js @@ -52,12 +52,12 @@ return baseclass.extend({ var date = new Date(unixtime * 1000), zn = uci.get('system', '@system[0]', 'zonename')?.replaceAll(' ', '_') || 'UTC', ts = uci.get('system', '@system[0]', 'clock_timestyle') || 0, - hc = uci.get('system', '@system[0]', 'clock_hourcycle') || 'h23'; + hc = uci.get('system', '@system[0]', 'clock_hourcycle') || 0; datestr = new Intl.DateTimeFormat(undefined, { dateStyle: 'medium', timeStyle: (ts == 0) ? 'long' : 'full', - hourCycle: hc, + hourCycle: (hc == 0) ? undefined : hc, timeZone: zn }).format(date); } diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js index 80ad921e9a..430c67e81b 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js @@ -52,12 +52,12 @@ function formatTime(epoch) { var date = new Date(epoch * 1000), zn = uci.get('system', '@system[0]', 'zonename')?.replaceAll(' ', '_') || 'UTC', ts = uci.get('system', '@system[0]', 'clock_timestyle') || 0, - hc = uci.get('system', '@system[0]', 'clock_hourcycle') || 'h23'; + hc = uci.get('system', '@system[0]', 'clock_hourcycle') || 0; return new Intl.DateTimeFormat(undefined, { dateStyle: 'medium', timeStyle: (ts == 0) ? 'long' : 'full', - hourCycle: hc, + hourCycle: (hc == 0) ? undefined : hc, timeZone: zn }).format(date); } @@ -157,7 +157,6 @@ return view.extend({ }; o = s.taboption('general', form.Flag, 'clock_timestyle', _('Full TimeZone Name'), _('Unchecked means the timezone offset (E.g. GMT+1) is displayed')); - o.default = o.enabled; o = s.taboption('general', form.ListValue, 'clock_hourcycle', _('Time Format')); o.value('', _('Default'));